home *** CD-ROM | disk | FTP | other *** search
/ Windows Expert / Windows Expert.iso / windownt / ibmsyn.zip / SEMFISDO.H < prev    next >
Text File  |  1992-08-05  |  9KB  |  177 lines

  1.  
  2. /* NT IBM SDLC Adapter Device Driver: Device Objects */
  3.  
  4.  
  5. /*       Resource Type equates */
  6.  
  7. #define GRABBEDRESOURCE_GOTDMA        0x04
  8.  
  9. //#############################################################################
  10.  
  11. /*****************************************************************************/
  12. /* Config data record                                                        */
  13. /*****************************************************************************/
  14.  
  15. typedef enum           _ADAPTER_TYPE
  16. {
  17.                         AT_NONE  = -1,
  18.                         AT_SDLC  = 0,
  19.                         AT_MPCA1 = 2,
  20.                         AT_MPCA2 = 3,
  21.                         AT_MPAA1 = 4,
  22.                         AT_MPAA2 = 5,
  23.                         AT_COUNT = 6
  24. }
  25.                         ADAPTER_TYPE;
  26.  
  27. typedef struct         _CONFIGDATA
  28. {
  29.   ADAPTER_TYPE          AdapterType;
  30.   char *                FlavourName;
  31.   IO_ADDRESS            AdapterBaseAddress;
  32.                         /* bottom byte (& 0xFF) can be used as an identifier */
  33.   UCHAR                 MPAAAdapterIdentifier;  /* as set in MCA POS register*/
  34.   UCHAR                 DMAChannel;         /* set by GetConfigData          */
  35.   IO_ADDRESS            MPCAModePort;
  36.   UCHAR                 MPCAModeValue;
  37.   ULONG                 AddressSpace;
  38.   ULONG                 BusNumber;
  39.   KIRQL                 Irql;
  40.   CCHAR                 Vector;
  41.   BOOLEAN               Shareable;          /* we share internally, not viaNT*/
  42.   KINTERRUPT_MODE       InterruptMode;
  43.   KIRQL                 Irql2;
  44.   CCHAR                 Vector2;
  45.   BOOLEAN               Shareable2;
  46.   KINTERRUPT_MODE       InterruptMode2;
  47. }                       CONFIGDATA,
  48.                      * PCONFIGDATA;
  49.  
  50. #define IRQ3 (KIRQL)((CCHAR)HIGH_LEVEL - 3)
  51. #define IRQ4 (KIRQL)((CCHAR)HIGH_LEVEL - 4)
  52.  
  53. /*****************************************************************************/
  54. /* The Device object - one per adapter.                                      */
  55. /*****************************************************************************/
  56.  
  57. typedef struct         _IBMSYNC_DEVICE_EXTENSION
  58. {
  59.   PDEVICE_OBJECT     pDeviceObject;     /* backpointer from extn -> DeviceObj*/
  60. #ifdef IBMSYNC_TRACE
  61.   TRC_NAME            Name;
  62. #endif
  63.   BOOLean             DeviceIsOpen;     /* true after successful OpenCreate  */
  64.                                         /* 'device' is NT object             */
  65.   BOOLean             AdapterIsClosing; /* 'adapter' is the card.  When this */
  66.                                         /* is set, ignore interrupts         */
  67.   PIRP                IoctlCurrentIrp;  /* Pass pIrp to Ioctl routines becos */
  68.                                         /* some are exec'd via KeSynchrExec  */
  69.                                         /* which can only pass pDX.          */
  70.   PKEVENT            pUserEvent;        /* user's event from SetSemaphoreH   */
  71.   BOOLean             HardwareError;    /* if set, fatal hardware error -    */
  72.                                         /* e.g. WAITUNTIL timed out          */
  73.                                         /* picked up @ end of EntryPtIoctl   */
  74.                                         /* Reset by AdapterReset             */
  75.   ULONG               Information;      /* If a synchronized routine wants to*/
  76.                                         /* return an error status, it can't  */
  77.                                         /* do it directly because synchnr.   */
  78.                                         /* routines return a boolean only.   */
  79.                                         /* Therefore return a failure        */
  80.                                         /* indication and set the IoStatus.  */
  81.                                         /* Information value in here.        */
  82.                                         /* Also used to return frame length  */
  83.                                         /* for IoctlRxFrame.                 */
  84.   NTSTATUS            IoctlRetStatus;   /* Set by Ioctl handlers to return   */
  85.                                         /* Ioctl statuses.                   */
  86.   int                 LinkMaxFrameSize; /* as set by user in Set Link Charcts*/
  87.                                         /* = max size allowed on this link   */
  88.  
  89.   PIR                pIR;               /* pointer to user interface record  */
  90.   IR                  OurIR;            /* dummy IR for initialisation!      */
  91. // /*IRMdl?*/   PMDL pIRMdl;            /* the IR that maps the interface rec*/
  92.                                         /* This is set up when the user calls*/
  93.                                         /* IoctlSetInterfaceRecord and relea-*/
  94.                                         /* sed when IoctlClose               */
  95.   CONFIGDATA          ConfigData;       /* copied from static configdata at  */
  96.                                         /* start of day                      */
  97. #define ADAPTERBASE ConfigData.AdapterBaseAddress
  98.   int                 DPCAction;        /* Set by interrupt routines to reqst*/
  99.                                         /* actions by DPC routine.  If this  */
  100.                                         /* is non-0, the exit from the       */
  101.                                         /* interrupt routine requests a DPC. */
  102.                                         /* The DPC routine resets it.        */
  103. #define DPC_ACTION_PULSE    1
  104.  
  105.   PKINTERRUPT         Interrupt;        /* standard interrupt (#1)           */
  106.   PKINTERRUPT         Interrupt2;       /* alternate interrupt (#2)          */
  107.  
  108.   // send buffer stuff
  109.  
  110.   UCHAR            * pSendBuf;
  111. #define               SENDBUF_SIZE 3000 /* as used by OS2 driver             */
  112.                                         /* allows 2*1024 x.25 frames + some  */
  113.   PMDL               pSendMdl;
  114.   PHYSICAL_ADDRESS    SendBufPhysAddr;
  115.   USHORT              TxConsecutiveUnderrunCount;
  116.   int                 TxFSMCurState;
  117.   USHORT              TxNextToBuffer;    /* index into pSendbuf.             */
  118.   USHORT              TxNextToTransmit;  /* index into pSendbuf.             */
  119.   UCHAR             *pTxPIOData;         /* pointer                          */
  120.   UCHAR               TxResult;          /* only 1 Tx result byte from 8273  */
  121.   USHORT              TxStartUnusedArea;
  122.  
  123.   /***************************************************************************/
  124.   /* Ok - what the heck is TxStartUnusedArea? (I hear you cry).              */
  125.   /*                                                                         */
  126.   /* When we start putting stuff into the buffer, we can put and get right   */
  127.   /* up to the end.  When the Put side wraps round, there will be some slop  */
  128.   /* at the end - from the end of the last buffered tx frame to the real end */
  129.   /* of the buffer.  This is then used by the Get side: we keep getting      */
  130.   /* Tx Frames out of the buffer until the next one would be past the        */
  131.   /* TxStartUnusedArea.  Once this occurs, we move the TxStartUnusedArea out */
  132.   /* to the BUFFER_SIZE again - the Put side is now restricted by this rather*/
  133.   /* than by TxNextToTransmit.                                               */
  134.   /*                                                                         */
  135.   /***************************************************************************/
  136.  
  137.   // receive buffer stuff
  138.  
  139.   RCVINFO             RcvInfo;          /* see rb.h for RCVINFO              */
  140.   int                 RxFSMCurState;
  141.   UCHAR             *pRxPIOData;
  142.   short               RxResultCount;
  143.   UCHAR               RxResultBuffer[8];/* RxResult bytes read from RxRes reg*/
  144.   UCHAR               OurAddress1;      /* user's address values held here   */
  145.   UCHAR               OurAddress2;
  146.  
  147.   UCHAR               LinkOptionsByte;  /* user's link options are held here */
  148.                                         /* the bits in this byte have the    */
  149.                                         /* same meaning as defined for the   */
  150.                                         /* SLLinkOptionsByte in ui.h         */
  151.   UCHAR               GrabbedResources;
  152.   BOOLEAN             DMAIsActive;
  153.  
  154.   UCHAR               CmdStringReadPortA[2];
  155.   UCHAR               CmdStringResetOpMode[3];
  156.   UCHAR               CmdStringResetSerialIOMode[3];
  157.   UCHAR               CmdStringSetOpMode[3];
  158.   UCHAR               CmdStringSetSerialIOMode[3];
  159.   UCHAR               CmdStringDataTransferMode[3];
  160.  
  161.   UCHAR               CmdStringResetPortB[3];
  162.   UCHAR               CmdStringSetPortB[3];
  163.  
  164.   UCHAR               CmdStringReceive[6];
  165.   UCHAR               CmdStringTransmit[6];
  166.   UCHAR               CmdStringAbortTransmit[2];
  167.   UCHAR               CmdStringDisableReceiver[2];
  168.  
  169.   UCHAR               LastPortA;        /* see GetV24Input/Write8273Cmd      */
  170.   BOOLean             PowerFailed;
  171. }
  172.                       IBMSYNC_DEVICE_EXTENSION,
  173.                      *PDX;              /* pDX normal name for extension ptr */
  174.  
  175. #define INIT_MAXFRSIZENOW  CAST((SENDBUF_SIZE-8) / 2, USHORT)
  176.                                         /* -8 allows for record lengths/safty*/
  177.